package com.ruget.ools.log.starter.useful.config;

import com.ruget.ools.log.starter.event.SysLogListener;
import com.ruget.ools.log.starter.useful.service.LogService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * description 日志配置类
 * create Time at 2022/9/1 9:37
 *
 * @author alice.ruge
 * @since 0.0.7
 */
@Configuration
public class LogAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public SysLogListener sysLogListener(LogService logService){
        SysLogListener sysLogListener = new SysLogListener((optLogDTO) -> logService.saveLog(optLogDTO));
        return sysLogListener;
    }
}